package com.diandian.backend.log.controller;

import com.diandian.backend.log.service.LogRecordService;
import com.diandian.base.boot.starter.response.BaseResult;
import com.diandian.backend.log.param.*;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;


/**
 * 日志记录表
 *
 * @author zyz diandian@qq.com
 * @since 1.0.0 2025-08-07
 */
@RestController
@RequestMapping("/log/record")
public class LogRecordController{

    @Autowired
    private LogRecordService iLogRecordService;

    /**
    * 1. 分页查询
    */
    @PostMapping("/page")
    public BaseResult page(@RequestBody LogRecordPageParam param) {
        param.check();
        return new BaseResult(0, "success", iLogRecordService.page(param.toDTO()));
    }

    /**
     * 5. 新增
     */
    @PostMapping("/add")
    public BaseResult add(@RequestBody LogRecordAddParam param) {
        param.check();
        iLogRecordService.add(param.toDTO());
        return new BaseResult(0, "success", null);
    }
}